package cumeo89.chii.client.undo;

import java.util.ArrayList;
import java.util.List;

public class UndoableSupport {

	private List<UndoableEditListener> listeners = new ArrayList<UndoableEditListener>();
	
	public void addUndoableEditListener(UndoableEditListener listener) {
		listeners.add(listener);
	}
	
	public void removeUndoableEditListener(UndoableEditListener listener) {
		listeners.remove(listener);
	}
	
	public void post(Object source, UndoableEdit edit) {
		edit.redo();
		for (UndoableEditListener listener : listeners) {
			listener.undoableEditHappened(source, edit);
		}
	}
	
}
